package com.woniu.api;

import com.woniu.entity.Product;
import com.woniu.entity.ProductDTO;
import com.woniu.entity.utils.ResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

@FeignClient("cyx-product")
@RequestMapping("/product")
public interface RemoteProductServer {
    @GetMapping("/{pid}")
    public ResponseEntity findOneById(@PathVariable("pid") Integer pid);    //这里PathVariable中必须要有参数名字

    @PutMapping("/")
    public ResponseEntity updateProduct(@RequestBody Product product);

    //    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice(@RequestParam("name") String name,@RequestParam("minPrice") double minPrice,
//                                               @RequestParam("maxPrice") double maxPrice);
//    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice1(@SpringQueryMap Map map);
    @GetMapping("/findCondition")
    public ResponseEntity findAllByNameOrPrice1(@SpringQueryMap ProductDTO productDTO);
}
